<template>
  <div class="set"  :updateStatusData="updateStatusData">
    <header><HeaderPublc></HeaderPublc></header>


    <el-dialog   :title="fromTitle" :visible.sync="shows" :width="width" style="text-align: left"  >
      <el-form ref="from" :model="from" label-width="90px" label-position="left" style="width:450px">
        <el-form-item label="费用名称:" v-show="costNameShow">
          <el-input type="textarea"
                    autosize
                    placeholder="请输入内容"
                    v-model="from.costName">
          </el-input>
        </el-form-item>
        <el-form-item v-show="costNameShow" label="金额:">
          <el-input placeholder="请输入金额"  v-model="from.cost" class="input-with-select">
           <span slot="append">
              {{fromData.nuit}}
            </span>
          </el-input>
        </el-form-item>
        <el-form-item v-show="!costNameShow " label="集装箱费用:">
          <el-input placeholder="请输入金额"  v-model="from.ctnPrice " class="input-with-select">
            <span slot="append">
              {{fromData.nuit}}
            </span>
          </el-input>
        </el-form-item>
        <el-form-item v-show="!costNameShow && from.linePrice" label="运输费用:">
          <el-input placeholder="请输入金额"  v-model="from.linePrice" class="input-with-select">
           <span slot="append">
              {{fromData.nuit}}
            </span>
          </el-input>
        </el-form-item>
        <el-form-item v-show="!costNameShow && from.consignPrice" label="拖车费用:">
          <el-input placeholder="请输入金额"  v-model="from.consignPrice" class="input-with-select">
            <span slot="append">
              {{fromData.nuit}}
            </span>
          </el-input>
        </el-form-item>
        <div class="" style="margin-top: 40px;text-align: center">
          <el-button type="primary" size="medium"   style="width: 45%" @click="setFn()" >添 加</el-button>
          <el-button size="medium"  @click="shows = false;from.cost = '';from.costName = ''" style="width:45%" >取 消</el-button>
        </div>
      </el-form>
    </el-dialog>

    <div class="container" id="container" :DetailData="DetailData">
      <div class="aside"  ><setPublc></setPublc></div>
      <div class="main " id="main" style="">
        <div class="title" >
          <div class="left" style="text-align: right;border-bottom: 0px;">
            <el-button   class="sub" size="small"  style="margin-right: 20px;" @click="goBack"> 返回 </el-button>
          </div>
          <div class="left " style="width: 200px"><span class="el-icon-edit-outline "></span> {{title}}</div>
          <div class="right">
            <span class="err" @click="updateOderStatus(7)"> 撤销订单</span>
          </div>
          <div class="cleae" ></div>
        </div>
        <div class="clearfix bottom" >
          <div class="list left" style="width: 50%">
            <p class="addrss"><span v-show="fromData.origin">{{fromData.origin}} —  </span> <span v-show="fromData.transitPort"> {{ fromData.transitPort}} — </span> <span v-show="fromData.dest">{{ fromData.dest}}</span></p>
            <p><span>订单状态：</span>
              <span>
                <el-select size="mini" :disabled="disabled"  v-model="fromData.status" placeholder="请选择" style="width: 200px" @change="updateOderStatus(fromData.status)">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  v-show="!item.none"
                >
                </el-option>
              </el-select>
              </span>
            </p>
            <p><span>下单时间：</span>
             <span >{{fromData.createTime}}</span>
            </p>
            <p>
              <span>订&nbsp 单 &nbsp号：</span>
              <span >{{fromData.number}}</span>
               </p>

            <p><span>发车时间：</span><span> 2018-04-24 15：30</span></p>
            <p v-show="fromData.weight"><span>重&nbsp&nbsp&nbsp&nbsp量 ：</span><span>{{fromData.weight}} （kg）</span></p>
            <p v-show="fromData.volume"><span>体&nbsp&nbsp&nbsp&nbsp积：</span><span> {{fromData.volume}} （m³）</span></p>
          </div>
          <div class="list left" style="width: 50%">

            <p><span>运输方式：</span><span> {{fromData.transMode}}</span></p>
            <p><span>出境口岸：</span><span> {{fromData.transitPort?fromData.transitPort:'-----'}}</span></p>
            <p><span>联 &nbsp系 &nbsp人：</span>

              <span >{{fromData.cttName}}</span>
            </p>
            <p ><span >手 &nbsp机 &nbsp号：</span>

              <span >{{fromData.cttPhone}}</span>
            </p>

            <p v-show="fromData.consignSuitcasePoint"><span >提&nbsp箱 &nbsp点</span>

              <span >{{fromData.consignSuitcasePoint}}</span>
            </p>
            <p v-show="fromData.goodsName"><span >品 &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp名：</span>

              <span >{{fromData.goodsName}}</span>
            </p>
            <p v-show="fromData.consignAddress"><span >拖车地点：</span>

              <span >{{fromData.consignAddress}}</span>
            </p>
            <p v-show="fromData.sendAddress"><span >派送地点：</span>

              <span >{{fromData.sendAddress}}</span>
            </p>

          </div>
        </div>
        <prec></prec>

      </div>
    </div>
  </div>
</template>
<style scoped>
  .err{color: #fd8d00;line-height:20px;cursor: pointer;font-size: 14px;margin-right: 10px;;background: url("../../../../static/img/icon/erorr.png")no-repeat ;padding-left: 25px;background-position: 0px -2px}
  .list .other p{font-size: 14px;color: #333}
   p{ text-align: left;font-size: 14px;color: #606266;}
  .set{width: 100%;height: 100%}
  .set header{width: 100%;height:60px}
  .set .container{width:  100%;height: 100%;}
  .set .container .aside{width: auto;height: 100%;float: left;background: #545c64;margin-right: 20px;}
  .set .container .aside{width: auto;height: 100%;float: left;background: #545c64;margin-right: 20px;}
  textarea{width: 100%;background: none;border: 0px none;height: 40px}
    .sev p{line-height: 30px }
  footer{width: 100%;clear: both }
  .set .container .main{float: left;width:80% }
  .set .container .show .main{margin-left: 80px}
  body{background-color:#f7f7f7}
  table{border-right:1px solid #909090;border-bottom:1px solid #909090;margin-left: 20px;width: 80%;margin-top: 40px}
  table  td{border-left:1px solid #909090;border-top:1px solid #909090;font-size: 12px;}
  .table table{border:0px none;}
  .table  table  td{border:0px none;text-align: left;line-height: 40px;}
  table td input{width: 100%;height: 40px;background: none;border: 0px none;text-indent: 10px}
  .table table td input{display:none}
  .table table td p{}
   table td p{display:none}

  .title{text-align: left;line-height: 50px;border-bottom: 1px solid #e1e1e1;}
  .sub{cursor: pointer ;position: relative;top: -3px;}
  .set{margin-right: 10px;font-size: 24px;}

  .dan input{ width: 80%}
  .cent .addrss{font-size: 16px;font-weight: bold}

  .imgBoxs img{max-width: 126px;height: 90px}
  .list{box-sizing: border-box;padding: 15px 30px; position: relative}
  .list p{line-height:25px;font-size: 16px;text-align: left;padding: 5px 0px}

  .list .addrss span{margin-right: 0px}
  .bottom{border-bottom: 1px solid #e1e1e1;}

  .textRight .right {width: 42%;}
  .textRight .right p{text-align:left ;font-size: 14px;font-weight: bold}
  .textRight .money p{text-align: right;font-size: 14px;font-weight: bold}



  @media only screen and (min-width: 1200px){
    .set .container .main{float: left;width:80% }
    .prec .cop .td{display: block;float: left;width: 42%;min-width: 150px}
  }
  @media only screen and (min-width: 1366px){
    .set .container .main{float: left;width:83% }
    .cuntBox .cuntCop{right: 15%}

  }
  @media only screen and (min-width: 1600px){
    .set .container .main{float: left;width:85% }
    .cuntBox .cuntCop{right: 20%}
    .prec .cop .td{display: block;float: left;width: 15%;min-width: 150px}

  }
  @media only screen and (min-width: 1920px){
    .set .container .main{float: left;width:88% }
    .cuntBox .cuntCop{right: 25%}
    .prec .cop .td{display: block;float: left;width: 18%;min-width: 150px}
  }


</style>
<script>
  import setPublc from '@/components/public/set.vue'
  import HeaderPublc from '@/components/public/herder.vue'
  import Public from '@/vuex/public'
  import prec from '@/components/public/prec.vue'
  import {mapState, mapActions} from 'vuex'
  export default {
    name: 'my-oderChart',
    created () {
      // 查看本页面路由 绑定对应页面class
      this.$store.commit('commitBizDetails', null)
      this.fromData.id = this.$route.query.id
      if(this.fromData.id){
        var parm = {
          id: this.fromData.id+''
        }

        this.showQuotationDetails(parm)
      }else {
        this.fromData.bizType = 1
      }
      this.type = this.$route.query.type
      var usr = sessionStorage.getItem('user');
      if(usr) {
        usr = JSON.parse(usr);
        if(usr.type == 0){
          // this.$router.push({ name: 'AdminConfig' })
        }
      }else {
        if(this.check != 'login'){
          // this.$router.push({ name: 'AdminConfig' })
        }
      }
    },
    data () {
      return {
        disabled:false,
        cost:[
          {
          costName:'拖车费用',cvalue:'678',cvalueD:"100"
        },//{
        //   costName:'报关',unit:'$',cost:'100'
        // },{
        //   costName:'人工',unit:'$',cost:'105'
        // },{
        //   costName:'包装',unit:'$',cost:'100'
        // }
        ],
        transitCost:[],
        costNameShow:false,
        disabled3:true,

        width:'500px',
        width2:30,
        shows:false,
        type:null,
        fromTitle:'添加费用',
        fromData : {

        },
        from : {
          id:'',
          costName:'',// 费用名称
          orderId:'',// 订单id
          cost:'', // 杂费金额
          unit:2,//单位
          fromType:"",//表单类
          consignPrice:'',//拖车费用
          ctnPrice:'',//集装箱费用
          linePrice:'',//线路费用
        },
        originCost:'',

        title:'订单详情',
        money: [{
          value: 2,
          label: '美元'

        }, {
          value: 1,
          label: '人民币'
        }],
        options2: [{
          value: 1,
          label: '待确认',
          disable:false
        },{
          value: 2,
          label: '已确认',
          disable:false
        },{
          value: 3,
          label: '已提交委托书',
          disable:false
        },{
          value: 4,
          label: '已付款',
          disable:false
        },{
          value: 5,
          label: '在途运输',
          disable:false
        },{
          value: 6,
          label: '运输完成',
          disable:false
        },{
          value: 7,
          label: '已失效',
          disable:false,
          none:true,
        }],
        options3: [{
          value: '20GP',
          label: '20GP'
        }, {
          value: '40GP',
          label: '40GP'
        }, {
          value: '40HQ',
          label: '40HQ'
        }],
      }
    },
    methods: {
      ...mapActions({
        showQuotationDetails:'quotationDetails',
        addCost:'addCost',
        modifyQuotationOrderDetail:'modifyQuotationOrderDetail',
        deleteCost:'deleteCost',
        modifyQuotationOrderStatus:'modifyQuotationOrderStatus'
      }),
      login () {
        this.$router.push({ name: 'map' })
      },
      goBack(){
        this.$router.back(-1)
      },
      setFn(){
        // 添加、修改，额外费用接口
        this.from.unit =  this.fromData.nuit == '$'? 2: this.fromData.nuit == '￥'?1:2
        if(this.from.fromType == 3 || this.from.fromType == 2){
          var parm = [{
            id:this.from.id,
            costName:this.from.costName,
            orderId:this.fromData.id,
            cost:this.from.cost,
            unit:parseInt(this.from.unit),
            originCost:this.originCost || ''
          }]
          this.addCost(parm)
        }else {
          var parm = {
            id :this.from.id,
            linePrice : parseFloat(this.from.linePrice),
            ctnPrice : parseFloat(this.from.ctnPrice),
            consignPrice : parseFloat(this.from.consignPrice),
            orderId:this.fromData.id,
            unit:parseInt(this.from.unit),
            originLinePrice: parseFloat(this.from.originLinePrice) || '',
            originCtnPrice: parseFloat(this.from.originCtnPrice) || '',
            originConsignPrice: parseFloat(this.from.originConsignPrice) || '',
          }
          var linePrice = this.moneychange('',parm.linePrice,parm.unit,this.fromData.rate).D
          var ctnPrice = this.moneychange('',parm.ctnPrice,parm.unit,this.fromData.rate).D
          var consignPrice = this.moneychange('',parm.consignPrice,parm.unit,this.fromData.rate).D

          // 查看输入价格是否和
          if(parm.originLinePrice){
              if(linePrice == parm.originLinePrice){
                delete parm.originLinePrice
                delete parm.linePrice
              }
          }
          if(parm.originCtnPrice){
            if(ctnPrice == parm.originCtnPrice){
              delete parm.originCtnPrice
              delete parm.ctnPrice
            }
          }
          if(parm.originConsignPrice){
            if(consignPrice == parm.originConsignPrice){
              delete parm.originConsignPrice
              delete parm.consignPrice
            }
          }

        this.modifyQuotationOrderDetail(parm)
        }
      },
      statusCheck(){

      },
      updateOderStatus(status){
        var parm = {
          orderId :this.fromData.id,
          status: status?status:this.fromData.status
        }
        this.modifyQuotationOrderStatus(parm)
      },
      //详情解析
      dataFn(res){
        res = res.body.data
        var time = Public.publicLo.timeCheng()
        if(res.createTime){
          time = Public.publicLo.timeCheng(res.createTime)
        }

        var dat= res.transitCost,linePrice={D:0,R:0},ctnPrice={D:0,R:0},consignPrice={D:0,R:0},cvalue={D:0,R:0},rate,transitCostTotal;
        this.transitCost=[];
        if(!res.cartonCount){
          res.cartonCount = 1
        }
        for(let i in dat){
          dat[i].cartonCount = dat[i].cartonCount? dat[i].cartonCount :1
          // 没有修改后价格，取原价 计算总价
          var datline = (dat[i].modifyLinePrice ? dat[i].modifyLinePrice : dat[i].linePrice),

            datctnPrice= dat[i].modifyCtnPrice ? dat[i].modifyCtnPrice : dat[i].ctnPrice,
            datconsignPrice= dat[i].modifyConsignPrice ? dat[i].modifyConsignPrice : dat[i].consignPrice;

          // 记录实际价格 单价
          var newlinePrice = this.moneychange('',datline,dat[i].unit,dat[i].rate),
            newctnPrice = this.moneychange('',datctnPrice,dat[i].unit,dat[i].rate),
            newconsignPrice = this.moneychange('',datconsignPrice,dat[i].unit,dat[i].rate);
            // 计算总价
          linePrice.D =  linePrice.D + (newlinePrice.D*dat[i].cartonCount)
          linePrice.R =  linePrice.R + (newlinePrice.R*dat[i].cartonCount)
          ctnPrice.D =  ctnPrice.D + (newctnPrice.D*dat[i].cartonCount)
          ctnPrice.R =  ctnPrice.R + (newctnPrice.R*dat[i].cartonCount)
          consignPrice.D =  consignPrice.D + (newconsignPrice.D*dat[i].cartonCount)
          consignPrice.R =  consignPrice.R + (newconsignPrice.R*dat[i].cartonCount)


          // 记录汇率
          rate = dat[0].rate
          // 记录原价
        var  oldlinePrice = this.moneychange('',dat[i].linePrice,dat[i].unit,dat[i].rate),
          oldctnPrice = this.moneychange('',dat[i].ctnPrice,dat[i].unit,dat[i].rate),
          oldconsignPrice = this.moneychange('',dat[i].consignPrice,dat[i].unit,dat[i].rate);


          this.transitCost.push({
            "id":dat[i].id,
            "volume":dat[i].volume,
            "weight":dat[i].weight,
            "cartonCount":dat[i].cartonCount || 1,
            "ctnOwner": dat[i].ctnOwner == 1? '中铁':dat[i].ctnOwner == 2?'租箱':dat[i].ctnOwner == 3?'买箱':dat[i].ctnOwner == 4?'俄铁':dat[i].ctnOwner == 5?"大洋":'',
            "cartonType":dat[i].cartonType,
            "linePrice":newlinePrice.R.toFixed(2),
            "ctnPrice":newctnPrice.R.toFixed(2),
            "consignPrice":newconsignPrice.R.toFixed(2),
            "linePriceD":newlinePrice.D.toFixed(2),
            "ctnPriceD":newctnPrice.D.toFixed(2),
            "consignPriceD":newconsignPrice.D.toFixed(2),
            "linePetty":dat[i].linePetty,
            "unit":dat[i].linePetty,
            "rate":dat[i].rate,
            "cvalue":this.moneychange('',dat[i].cvalue,dat[i].unit,dat[i].rate).R.toFixed(2),
            "cvalueD":this.moneychange('',dat[i].cvalue,dat[i].unit,dat[i].rate).D.toFixed(2),
            oldLinePrice:oldlinePrice.D ? oldlinePrice.D.toFixed(2) : '',
            oldCtnPrice:oldctnPrice.D ? oldctnPrice.D.toFixed(2)  : '',
            oldConsignPrice:oldconsignPrice.D ? oldconsignPrice.D.toFixed(2)  : '',
            oldLinePriceR:oldlinePrice.R ? oldlinePrice.R.toFixed(2) : '',
            oldCtnPriceR:oldctnPrice.R ? oldctnPrice.R.toFixed(2)  : '',
            oldConsignPriceR:oldconsignPrice.R ? oldconsignPrice.R.toFixed(2)  : '',
            "remark":dat[i].remark,
            "createTime":dat[i].createTime,
            "updateTime":dat[i].updateTime,
            consignSuitcasePoint:res.consignSuitcasePoint,
            goodsName:res.goodsName,
          })
        }
        dat= res.cost
        this.cost=[]

        for (let i in dat){
          var cost =this.moneychange('',dat[i].cost,dat[i].costUnit,rate)
          var modifyCost =this.moneychange('',dat[i].modifyCost,dat[i].costUnit,rate)
          this.cost.push({
             id:dat[i].id,
             costName:dat[i].costName,
            oldCost:cost.R.toFixed(2), // 原价
            oldCostD:cost.D.toFixed(2),//
            cost: modifyCost.R.toFixed(2),// 折扣后价格
            costD: modifyCost.D.toFixed(2)
          })
        }
        cvalue = this.moneychange('',res.cvalue,2,rate)
      if(res.status>=6){
        this.disabled = true
      }
        this.fromData = {
          "id":res.id,
          "number":res.number,// 订单号
          "customerName":res.customerName,// 公司名称
          "cttName":res.cttName,// 联系人
          "cttPhone":res.cttPhone,//联系人电话
          "transMode":res.transMode,//运输类型
          "origin":res.origin|| '',//起始的
          "dest":res.dest || '',//目的地
          "status":res.status,
          goodsName:res.goodsName,
          "cartonType":res.cartonType,//箱型
          "cartonCount":res.cartonCount,//箱量
          "transitPort":res.transitPort,//过境
          "createTime":Public.publicLo.timeCheng(res.createTime).ymd || '', //下单时间
          linePrice:linePrice.R ? linePrice.R.toFixed(2) : '',
          ctnPrice:ctnPrice.R ? ctnPrice.R.toFixed(2) : '',
          consignPrice:consignPrice.R ? consignPrice.R.toFixed(2) : '',
          cvalue:cvalue.R ? cvalue.R.toFixed(2) : 0,
          linePriceD:linePrice.D ? linePrice.D.toFixed(2) : '',
          ctnPriceD:ctnPrice.D ? ctnPrice.D.toFixed(2) : '',
          consignPriceD:consignPrice.D ? consignPrice.D.toFixed(2) : '',
          cvalueD:cvalue.D ? cvalue.D.toFixed(2) : '',
          nuit:'$',
          unit:2,
          rate :rate,
          costTotal: this.moneychange('',res.costTotal,2,rate).R.toFixed(2),
          costTotalD: this.moneychange('',res.costTotal,2,rate).D.toFixed(2),
          consignAddress:res.consignAddress,
          sendAddress:res.sendAddress,
        }
        if(this.fromData)
        if(this.transitCost[0].volume){
          this.fromData.volume = this.transitCost[0].volume
          this.fromData.weight = this.transitCost[0].weight
        }

      },
      // 价格转换
      moneychange(arr,number,a,reta){
        var c = reta
        var res = arr ||{
          'R':0,
          'D':0
        }

        if(!number){
          return res
        }else {
          // number = parseFloat(number)
        }
        if(a==1){
          res.R = res.R + number;
          res.D = res.D+(number/c)
        }
        if(a!=1){
          res.D = res.D + number;
          res.R = res.R+(number*c)
        }
        res.reta = reta

        return res
      },
      // 操作是否成功
      listStatus (res) {
        if (res.status == 0) {
          // 修改成功
          var text = '';
          // if(res.code == 'addCost'){
          //   if(this.from.id){
          //     text = '额外费用修改成功'
          //   }
          //   if(!this.from.id){
          //     text = '额外费用添加成功'
          //   }
          // }
          // if(res.code == 'modifyQuotationOrderDetail'){
          //   text = '费用修改成功'
          // }
          // if(res.code == 'addQuotation'){
          //   text = '费用添加成功'
          // }
          // if(res.code == 'deleteCost'){
          //   text = '额外费用删除成功'
          // }
          if(res.code == 'modifyQuotationOrderStatus'){
            text = '订单状态修改成功'
            this.openSuccess(text);
            var parm = {
              id: this.fromData.id
            }
            this.showQuotationDetails(parm);
          }

          // if(!this.fromData.id){
          //   this.fromData.id = res.data.id
          // }else {
          //
          // }
          // this.from={
          //   id:'',
          //   costName:'',
          //   orderId:'',
          //   cost:'',
          //   unit:2,
          //   fromType:""
          // }
          // 刷新列表

        }
        if (res.status != 0) {
          // 修改 修改失败
          var text = '添加失败';
          this.openError(text)
        }
        // 清空 vuex 中的本次记录，以免被下次操作状态造成混淆
        //this.$store.commit('updateStatusTo', {body: null})
      },

      openSuccess (text) {
        this.$message({
          message: text,
          type: 'success'
        })
      },

      openError (text) {
        this.$message.error(text)
      },

      // 校验
      rule() {
        var ret = ''
        // 铁路运输的 的 表单验证验证
        if (this.fromData.bizType == 1) {
          if (!this.fromData.origin) {
            ret = '发站代码不能为空'
            return ret
          }
          if (!this.fromData.dest) {
            ret = '到站代码不能为空'
            return ret
          }
          if (!this.fromData.goodsName) {
            ret = '货品名不能为空'
            return ret
          }
        }
        // 海上运输的表单验证
        if (this.fromData.bizType == 2) {
          if (!this.fromData.origin) {
            ret = '起运地/起运港不能为空'
            return ret
          }
          if (!this.fromData.dest) {
            ret = '目的地/目的港不能为空'
            return ret
          }
          if (!this.fromData.goodsName) {
            ret = '品名不能为空'
            return ret
          }
        }
        // 通用验证
        if (!this.fromData.cartonType) {
          ret = '箱型不能为空'
          return ret
        }
        if (!this.fromData.cartonCount) {
          ret = '箱量不能为空'
          return ret
        }
        if (!this.fromData.customerName) {
          ret = '公司名称不能为空'
          return ret
        }
        if (!this.fromData.cttName) {
          ret = '姓名不能为空'
          return ret
        }
        if (!this.fromData.cttPhone) {
          ret = '联系方式不能为空'
          return ret
        }
      },
      keyUp(parm,status){
        parm = parm.replace(/[^0-9-]+/,'');
        if(status == 'cttPhone'){
          this.fromData.cttPhone = parm
        }
        if(status == 'weight'){
          this.fromData.weight = parm
        }
        if(status == 'volume'){
          this.fromData.volume = parm
        }
        if(status == 'cvalue'){
          this.fromData.cvalue = parm
        }
      },

      updateFn(a,list){
        //删除
        if(a == 4){
          var parm ={
            id :list.id,
            orderId:this.fromData.id,
            originCost:list.costD
          }
          this.deleteCost(parm)
          return
        }
        this.shows = true;
        this.from.fromType = a;
        if(a == 1){ // 修改当前费用
          var consignPrice,ctnPrice,linePrice //拖车费用 集装箱费用 线路费用
          if( this.from.unit == 1){
            linePrice = (list.linePrice && list.linePrice != 0.00) ? list.linePrice : 0
            ctnPrice = (list.ctnPrice && list.ctnPrice != 0.00) ? list.ctnPrice : ''
            consignPrice = (list.consignPrice && list.consignPrice != 0.00) ? list.consignPrice : ''
          }else {
            linePrice =(list.linePriceD && list.linePriceD != 0.00) ? list.linePriceD : ''
            ctnPrice =(list.ctnPriceD && list.ctnPriceD != 0.00) ?  list.ctnPriceD : ''
            consignPrice =(list.consignPriceD && list.consignPriceD != 0.00) ?  list.consignPriceD : ''
          }

          this.costNameShow = false
          this.from.id = list.id;
          // 表单 线路 集装箱 拖车
          this.from.linePrice =  linePrice
          this.from.ctnPrice =  ctnPrice
          this.from.consignPrice = consignPrice;
          // 原价 线路 集装箱 拖车  ！ 0.00 赋值 0

          this.from.originLinePrice = (list.oldLinePrice && list.oldLinePrice!=0.00)?list.oldLinePrice:''
          this.from.originCtnPrice = (list.oldCtnPrice && list.oldCtnPrice!=0.00)?list.oldCtnPrice:''
          this.from.originConsignPrice = (list.oldConsignPrice && list.oldConsignPrice!=0.00)?list.oldConsignPrice:''

          this.fromTitle = '修改当前费用'
        }
        if(a == 2){
          this.costNameShow = true
          this.from.id = list.id;
          this.from.costName = list.costName;
          this.from.cost = this.from.unit == 1 ? list.cost : list.costD
          this.originCost = list.costD
          this.fromTitle = '修改额外费用'
        }
        if(a == 3){
          this.costNameShow = true
          this.originCost = ''
          this.fromTitle = '添加额外费用'
        }
      }
      },
    computed: {
      DetailData() {
        var parm = this.Detail
        if (parm) {

          this.dataFn(parm)
        }
        return 1
      },
      updateStatusData: function () {
        var parm = this.updateStatus
        if (parm) {
          if(parm== 'out'|| parm=='outErorr'){

          }else {
            this.listStatus(parm)
          }
        }
        return 1
      },
      ...mapState([
        'Detail',
        'updateStatus',
        'language',
      ])
    },
    mounted () {

    },
    components: {
      HeaderPublc: HeaderPublc,
      prec:prec,
      setPublc:setPublc,
    }
  }
</script>

